home *** CD-ROM | disk | FTP | other *** search
/ Mastering Web Site Development / Microsoft Mastering Web Site Development (Microsoft) (1997).iso / Labs / StateUFinal / global.asa < prev    next >
Text File  |  1997-04-24  |  2KB  |  49 lines

  1. <SCRIPT LANGUAGE="VBScript" RUNAT="Server">
  2. Sub Session_OnStart
  3.     '==Visual InterDev Generated - DataConnection startspan==
  4.     '--Project Data Connection
  5.         Session("StateU_ConnectionString") = "DSN=StateU;UID=sa;PWD=;"
  6.         Session("StateU_ConnectionTimeout") = 15
  7.         Session("StateU_CommandTimeout") = 30
  8.         Session("StateU_RuntimeUserName") = "sa"
  9.         Session("StateU_RuntimePassword") = ""
  10.     '==Visual InterDev Generated - DataConnection endspan==
  11.     
  12.     Application.Lock
  13.     Application("hitcounter")=Application("hitcounter")+1
  14.     Application.Unlock
  15.  
  16.     'if they haven't hit the profile page, redirect them there
  17.     startPage = "/StateUFinal/profile.asp"
  18.         currentPage = Request.ServerVariables("SCRIPT_NAME")
  19.     Session("requestedPage") = currentpage
  20.  
  21.     ' Do a case-insensitive compare, and if they
  22.     ' don't match, send the user to the start page.
  23.     if strcomp(currentPage,startPage,1) then
  24.         Response.Redirect(startPage)
  25.     end if
  26.     
  27. End Sub
  28.  
  29. Sub Application_OnStart
  30.     Dim fs, txtFile
  31.     Set fs = CreateObject("Scripting.FileSystemObject")
  32.     hitfile = "c:\hitcounter.txt"
  33.     Set txtFile = fs.OpenTextFile(hitfile)
  34.     Application.Lock
  35.     Application("hitcounter") = txtFile.ReadLine
  36.     Application.Unlock
  37.     txtFile.Close
  38. End sub
  39.  
  40. Sub Application_OnEnd
  41.     Dim fs, txtFile
  42.     Set fs = CreateObject("Scripting.FileSystemObject")
  43.     hitfile = "c:\hitcounter.txt"
  44.     Set txtFile = fs.CreateTextFile(hitfile, True)
  45.     txtFile.WriteLine(Application("hitcounter"))
  46.     txtFile.Close
  47. End Sub
  48. </SCRIPT>
  49.